#include "DisplayList.h"
#include <assert.h>

DisplayList::DisplayList()
{
	_id = 0;
}

DisplayList::~DisplayList()
{
	if (_id==0){return;}
	glDeleteLists(_id, 1);
}

void DisplayList::start()
{
	if (_id!=0){assert(!"List already used!");}
	_id = glGenLists(1);
	glNewList(_id, GL_COMPILE);
}

void DisplayList::end()
{
	glEndList();
}

void DisplayList::draw()
{
	glCallList(_id);
}